package com.example.cstr.service.serviceImpl;

import com.example.cstr.entity.EducationTrainProject;
import com.example.cstr.entity.Message;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.example.cstr.mapper.EducationTrainClassMapper;
import com.example.cstr.entity.EducationTrainClass;
import com.example.cstr.service.EducationTrainClassService;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Service
public class EducationTrainClassServiceImpl implements EducationTrainClassService {

    @Resource
    private EducationTrainClassMapper educationTrainClassMapper;

    @Override
    public int deleteByPrimaryKey(Integer etcId) {
        return educationTrainClassMapper.deleteByPrimaryKey(etcId);
    }

    @Override
    public int insert(EducationTrainClass record) {
        return educationTrainClassMapper.insert(record);
    }

    @Override
    public int insertSelective(EducationTrainClass record) {
        return educationTrainClassMapper.insertSelective(record);
    }

    @Override
    public EducationTrainClass selectByPrimaryKey(Integer etcId) {
        return educationTrainClassMapper.selectByPrimaryKey(etcId);
    }

    @Override
    public int updateByPrimaryKeySelective(EducationTrainClass record) {
        return educationTrainClassMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(EducationTrainClass record) {
        return educationTrainClassMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<EducationTrainClass> selectAllEducationTrainClass() {
        return educationTrainClassMapper.selectAllEducationTrainClass();
    }

    @Override
    public Message PagingSearch(@RequestParam Integer pageNum, @RequestParam Integer size) {
        PageHelper.startPage(pageNum, size);
        List<EducationTrainClass> educationTrainClassList = educationTrainClassMapper.selectAllEducationTrainClass();
        PageInfo pageInfo = new PageInfo(educationTrainClassList);
        pageInfo.getTotal();
        return Message.success(null).add(pageInfo);
    }

    @Override
    public List<EducationTrainClass> selectEtcIdByWorkId(Integer workId) {
        return educationTrainClassMapper.selectEtcIdByWorkId(workId);
    }

    @Override
    public List<EducationTrainClass> selectAllByYearId(Integer yearId) {
        return educationTrainClassMapper.selectAllByYearId(yearId);
    }
}










